package com.ftl.framework;


import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;



public class Dialog {
    public static void alert(Context context, String title, String message) {
    	Dialog.alert(context, title, message,null);  
    }
    
    public static void alert(Context context, String title, String message,DialogButton closeButton) {
    	AlertDialog.Builder builder = new AlertDialog.Builder(context);
    	builder.setTitle(title);
    	builder.setMessage(message);
    	
    	if (closeButton != null)
    	{
    		builder.setNeutralButton(closeButton.getText(), closeButton.getListener());
    	}
    	else
    	{
    		builder.setNeutralButton("Cerrar", null);
    	}
    	
    	builder.show();
    		
    }
    
    
    public static void confirm(Context context ,String title,String message, DialogButton yesButton, DialogButton noButton )
    {
    	confirm(context,title,message,yesButton,noButton,null);
    }

    public static void confirm(Context context ,String title,String message, DialogButton yesButton, DialogButton noButton, DialogButton neutralButton )
    {
    	AlertDialog.Builder builder = new AlertDialog.Builder(context);
    	builder.setTitle(title);
    	builder.setMessage(message);
    	
    	if (yesButton != null)
    	{
    		builder.setPositiveButton(yesButton.getText(), yesButton.getListener());
    	}
    	else
    	{
    		builder.setPositiveButton("Si", null);
    	}

    	if (noButton != null)
    	{
    		builder.setNegativeButton(noButton.getText(), noButton.getListener());
    	}
    	else
    	{
    		builder.setNegativeButton("No", null);
    	}    	
    
    	if (neutralButton != null)
    	{
    		
    		builder.setNeutralButton(neutralButton.getText(), neutralButton.getListener());
    	}
    	
    	
    	builder.show();

    }
    
    public static ProgressDialog progress(Context context,String title,String message,boolean indeterminate)
    {
    	return ProgressDialog.show(context,title,message, indeterminate); 
    }

}

